Optimal. Leaf size=73 \[ \frac {a^2 (A-B) \sin (c+d x)}{d}+\frac {a^2 (A+2 B) \tanh ^{-1}(\sin (c+d x))}{d}+a^2 x (2 A+B)+\frac {B \sin (c+d x) \left (a^2 \sec (c+d x)+a^2\right )}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.13, antiderivative size = 73, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.103, Rules used = {4018, 3996, 3770} \[ \frac {a^2 (A-B) \sin (c+d x)}{d}+\frac {a^2 (A+2 B) \tanh ^{-1}(\sin (c+d x))}{d}+a^2 x (2 A+B)+\frac {B \sin (c+d x) \left (a^2 \sec (c+d x)+a^2\right )}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3770
Rule 3996
Rule 4018
Rubi steps
\begin {align*} \int \cos (c+d x) (a+a \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx &=\frac {B \left (a^2+a^2 \sec (c+d x)\right ) \sin (c+d x)}{d}+\int \cos (c+d x) (a+a \sec (c+d x)) (a (A-B)+a (A+2 B) \sec (c+d x)) \, dx\\ &=\frac {a^2 (A-B) \sin (c+d x)}{d}+\frac {B \left (a^2+a^2 \sec (c+d x)\right ) \sin (c+d x)}{d}-\int \left (-a^2 (2 A+B)-a^2 (A+2 B) \sec (c+d x)\right ) \, dx\\ &=a^2 (2 A+B) x+\frac {a^2 (A-B) \sin (c+d x)}{d}+\frac {B \left (a^2+a^2 \sec (c+d x)\right ) \sin (c+d x)}{d}+\left (a^2 (A+2 B)\right ) \int \sec (c+d x) \, dx\\ &=a^2 (2 A+B) x+\frac {a^2 (A+2 B) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a^2 (A-B) \sin (c+d x)}{d}+\frac {B \left (a^2+a^2 \sec (c+d x)\right ) \sin (c+d x)}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 1.66, size = 258, normalized size = 3.53 \[ \frac {a^2 \cos ^3(c+d x) \sec ^4\left (\frac {1}{2} (c+d x)\right ) (\sec (c+d x)+1)^2 (A+B \sec (c+d x)) \left (-\frac {(A+2 B) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}+\frac {(A+2 B) \log \left (\sin \left (\frac {1}{2} (c+d x)\right )+\cos \left (\frac {1}{2} (c+d x)\right )\right )}{d}+x (2 A+B)+\frac {A \sin (c) \cos (d x)}{d}+\frac {A \cos (c) \sin (d x)}{d}+\frac {B \sin \left (\frac {d x}{2}\right )}{d \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )}+\frac {B \sin \left (\frac {d x}{2}\right )}{d \left (\sin \left (\frac {c}{2}\right )+\cos \left (\frac {c}{2}\right )\right ) \left (\sin \left (\frac {1}{2} (c+d x)\right )+\cos \left (\frac {1}{2} (c+d x)\right )\right )}\right )}{4 (A \cos (c+d x)+B)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.48, size = 108, normalized size = 1.48 \[ \frac {2 \, {\left (2 \, A + B\right )} a^{2} d x \cos \left (d x + c\right ) + {\left (A + 2 \, B\right )} a^{2} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (A + 2 \, B\right )} a^{2} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (A a^{2} \cos \left (d x + c\right ) + B a^{2}\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.96, size = 157, normalized size = 2.15 \[ \frac {{\left (2 \, A a^{2} + B a^{2}\right )} {\left (d x + c\right )} + {\left (A a^{2} + 2 \, B a^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (A a^{2} + 2 \, B a^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {2 \, {\left (A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 1}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.93, size = 107, normalized size = 1.47 \[ 2 a^{2} A x +a^{2} B x +\frac {a^{2} A \sin \left (d x +c \right )}{d}+\frac {a^{2} A \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {2 A \,a^{2} c}{d}+\frac {a^{2} B \tan \left (d x +c \right )}{d}+\frac {2 B \,a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {B \,a^{2} c}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.34, size = 105, normalized size = 1.44 \[ \frac {4 \, {\left (d x + c\right )} A a^{2} + 2 \, {\left (d x + c\right )} B a^{2} + A a^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 2 \, B a^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 2 \, A a^{2} \sin \left (d x + c\right ) + 2 \, B a^{2} \tan \left (d x + c\right )}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 2.01, size = 161, normalized size = 2.21 \[ \frac {A\,a^2\,\sin \left (c+d\,x\right )}{d}+\frac {4\,A\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,A\,a^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,B\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {4\,B\,a^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {B\,a^2\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ a^{2} \left (\int A \cos {\left (c + d x \right )}\, dx + \int 2 A \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx + \int A \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int B \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx + \int 2 B \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int B \cos {\left (c + d x \right )} \sec ^{3}{\left (c + d x \right )}\, dx\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________